﻿using System;
using System.Collections.Generic;
using NHibernate;

namespace UrimTumim.ProjectManager.DataAccess.NHibernate
{
    public class DataAccessBase<T, I>
    {
        public ISession Session { get; private set; }

        public DataAccessBase()
        {
        }

        /// <summary>
        /// Return the persistent instance of the given entity class with the given 
        /// identifier, assuming that the instance exists.
        /// </summary>
        /// <param name="id">
        /// A valid identifier of an existing persistent instance of the class.
        /// </param>
        /// <returns>
        /// The persistent instance or proxy.
        /// </returns>
        public T Load(I id)
        {
            return Session.Load<T>(id);
        }
    }
}
